package com.edou.index.controller;

import com.edou.base.controller.BaseController;
import com.edou.cms.service.ICmsAdvPhotoService;
import com.edou.cms.service.ICmsAdvService;
import com.edou.cms.service.ICmsArticleService;
import com.edou.cms.service.ICmsChannelService;
import com.edou.member.form.MemberUserForm;
import com.edou.member.service.IMemberUserService;
import com.edou.system.service.ISysDictItemService;
import com.edou.system.service.ISysUploadFileService;
import com.edou.system.service.ISysUploadSetService;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.util.Map;

/**
 * 首页
 *
 * @author Administrator
 */
@Controller("IndexController")
@Scope("prototype")
@RequestMapping("/")
public class IndexController extends BaseController {

    @Resource(name = "cmsAdvPhotoServiceImpl")
    private ICmsAdvPhotoService cmsAdvPhotoService;
    @Resource(name = "cmsAdvServiceImpl")
    private ICmsAdvService cmsAdvService;
    @Resource(name = "cmsArticleServiceImpl")
    private ICmsArticleService cmsArticleService;
    @Resource(name = "cmsChannelServiceImpl")
    private ICmsChannelService cmsChannelService;
    @Resource(name = "memberUserServiceImpl")
    private IMemberUserService memberUserService;
    @Resource(name = "sysDictItemServiceImpl")
    private ISysDictItemService sysDictItemService;
    @Resource(name = "sysUploadFileServiceImpl")
    private ISysUploadFileService sysUploadFileService;
    @Resource(name = "sysUploadSetServiceImpl")
    private ISysUploadSetService sysUploadSetService;

    //首页
    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView index(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("ftl/index/index");
        Map<String, Object> data = view.getModel();
        return view;
    }


    //跳转到手机验证页面
    @RequestMapping(value = "/phone/verify.htm", method = RequestMethod.GET)
    public ModelAndView phoneVerify(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("/member/register/phone_verify");
        Map<String, Object> data = view.getModel();
        return view;
    }

    //跳转到选择入口页面
    @RequestMapping(value = "/select/entrance.htm", method = RequestMethod.GET)
    public ModelAndView selectEntrance(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("/member/register/select_entrance");
        Map<String, Object> data = view.getModel();
        return view;
    }

    //跳转到教練註冊页面
    @RequestMapping(value = "/coach/register.htm", method = RequestMethod.GET)
    public ModelAndView coachRegister(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("/member/register/coach_register");
        Map<String, Object> data = view.getModel();
        return view;
    }

    //跳转到粉丝/球员首页
    @RequestMapping(value = "/fans/index.htm", method = RequestMethod.GET)
    public ModelAndView fansIndex(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("/member/index/fans_index");
        Map<String, Object> data = view.getModel();
        return view;
    }

    //跳转到家长首页
    @RequestMapping(value = "/patriarch/index.htm", method = RequestMethod.GET)
    public ModelAndView patriarchIndex(@ModelAttribute MemberUserForm model, HttpServletRequest request, HttpServletResponse response, HttpSession session) {
        ModelAndView view = new ModelAndView();
        view.setViewName("/member/index/patriarch_index");
        Map<String, Object> data = view.getModel();
        return view;
    }
}
